package com.yphone.ui.login.presenter;

import android.text.TextUtils;

import com.yphone.net.IUIDataListener;
import com.yphone.net.bean.BaseResultWrapper;
import com.yphone.tools.MyLog;
import com.yphone.ui.dialog.CommSmallLoadingDialog;
import com.yphone.ui.login.activity.ForgetPasswordActivity;
import com.yphone.ui.login.activity.LoginActivity;
import com.yphone.ui.login.bean.request.ForgetPwdRequestInfo;
import com.yphone.ui.login.bean.respone.ForgetPwdResponeInfo;
import com.yphone.ui.login.contract.ForgetPasswrodActivityContract;
import com.yphone.ui.login.model.ForgetPasswordActivityModel;
import com.yphone.utils.ToastUtils;

public class ForgetPasswordActivityPresenter implements ForgetPasswrodActivityContract.IPresenter {
    private IUIDataListener iuiDataListener = new IUIDataListener() {
        public void uiDataSuccess(Object object) {
            BaseResultWrapper<ForgetPwdResponeInfo> userinfoWrapper = (BaseResultWrapper) object;
            if (userinfoWrapper == null || userinfoWrapper.code != 1) {
                MyLog.d(ForgetPasswordActivityPresenter.class.getSimpleName(), "忘记密码修改失败！");
                if (!TextUtils.isEmpty(userinfoWrapper.msg)) {
                    ToastUtils.showLong((CharSequence) userinfoWrapper.msg);
                }
                CommSmallLoadingDialog.dismissDialog();
                return;
            }
            if (!TextUtils.isEmpty(userinfoWrapper.msg)) {
                ToastUtils.showLong((CharSequence) userinfoWrapper.msg);
            }
            MyLog.d(ForgetPasswordActivityPresenter.class.getSimpleName(), "忘记密码修改成功！");
            LoginActivity.toLoginActivity(ForgetPasswordActivityPresenter.this.mIView.getContext());
            CommSmallLoadingDialog.dismissDialog();
            ((ForgetPasswordActivity) ForgetPasswordActivityPresenter.this.mIView.getContext()).finish();
        }

        public void uiDataError(Exception error) {
            MyLog.d(ForgetPasswordActivityPresenter.class.getSimpleName(), "忘记密码修改异常！");
            CommSmallLoadingDialog.dismissDialog();
        }
    };
    /* access modifiers changed from: private */
    public ForgetPasswrodActivityContract.IView mIView;
    private ForgetPasswordActivityModel mImodel;

    public ForgetPasswordActivityPresenter(ForgetPasswrodActivityContract.IView IView) {
        this.mIView = IView;
        this.mImodel = new ForgetPasswordActivityModel();
    }

    public void load(String phone_number, String password, String verificationCode) {
        ForgetPwdRequestInfo info = new ForgetPwdRequestInfo();
        info.PhoneNumber = phone_number;
        info.PassWord = password;
        info.SMSVerifyCode = verificationCode;
        this.mImodel.finishAmendRequestToSer(this.iuiDataListener, info);
    }

    public void start() {
    }

    public void destory() {
        this.mImodel.destory();
    }
}